//
//  BaseAdjustButton.h
//  LoveIN
//
//  Created by wangpanpan on 2019/12/12.
//  Copyright © 2019 bst. All rights reserved.
//

#import <UIKit/UIKit.h>
/**
 [itemButton setTitle:nameArrs[index][1] forState:UIControlStateNormal];//会重写2次titleRect,且for循环结束
 [itemButton setTitleColor:kColor180 forState:UIControlStateNormal];
 itemButton.titleLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightRegular];//会重写1次titleRect,且for循环结束
 [itemButton setImage:[UIImage getPNGimageInBundleWithName:nameArrs[index][0]] forState:UIControlStateNormal];//会重写5次imageRect,且for循环结束
 */
//记住 这些属性 必须在初始化。给定frame 之后就需要传入 在setTitle titleLabel.font setImage 之前
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSUInteger, BaseAdjustLayoutType) {
    layoutTypeHorizontalLeftImageRightTitle,
    layoutTypeHorizontalLeftTitleRightImage,
    layoutTypeVerticalTopImageBottomTitle,
    layoutTypeVerticalTopTitleBottomImage,
    layoutTypeOnlyImage,
};
@interface BaseAdjustButton : UIButton
@property(nonatomic,assign)CGRect wppImageRect;
@property(nonatomic,assign)CGRect wppTitleRect;

//类型
@property(nonatomic,assign)BaseAdjustLayoutType type;

//标题
@property(nonatomic,strong)NSString *title;
@property(nonatomic,assign)CGFloat fontSize;
@property(nonatomic,assign)UIFontWeight fontWeight;
//图片
@property(nonatomic,assign)CGFloat imageWidth;
@property(nonatomic,assign)CGFloat imageHeight;
//距离
@property(nonatomic,assign)CGFloat marginLeft;
@property(nonatomic,assign)CGFloat marginRight;
@property(nonatomic,assign)CGFloat marginTop;
@property(nonatomic,assign)CGFloat marginBottom;
@property(nonatomic,assign)CGFloat marginItemX;
@property(nonatomic,assign)CGFloat marginItemY;


- (void)begin;
@end

NS_ASSUME_NONNULL_END

/**
 BaseAdjustButton *button = [BaseAdjustButton buttonWithType:UIButtonTypeCustom];
 [self.view addSubview:button];
 
 button.type = layoutTypeHorizontalLeftImageRightTitle;
 button.type = layoutTypeHorizontalLeftTitleRightImage;
 button.type = layoutTypeVerticalTopImageBottomTitle;
 button.type = layoutTypeVerticalTopTitleBottomImage;
 
 button.title = @"测试啊啊啊啊";
 button.fontSize = 24*ADAPTER_WIDTH;
 button.font = UIFontWeightRegular;
 
 button.imageWidth = 12*ADAPTER_WIDTH;
 button.imageHeight = 12*ADAPTER_WIDTH;
 
 button.marginLeft = 10*ADAPTER_WIDTH;
 button.marginRight = 10*ADAPTER_WIDTH;
 button.marginTop = 10*ADAPTER_WIDTH;
 button.marginBottom = 10*ADAPTER_WIDTH;
 button.marginItemX = 5*ADAPTER_WIDTH;
 button.marginItemY = 5*ADAPTER_WIDTH;
 
 button.type = layoutTypeOnlyImage;
 
 [button begin];
 button.left = 0;
 button.top = kTopHeight;
 
 [button setTitleColor:kColor153 forState:UIControlStateNormal];
 [button setImage:[UIImage getPNGimageInBundleWithName:@"IncomeHome_bottom_?"] forState:UIControlStateNormal];
 [button addTarget:self action:@selector(haha) forControlEvents:UIControlEventTouchUpInside];
 
 button.backgroundColor = RGB(0, 0, 0, 0.5);
 button.titleLabel.backgroundColor = RGB(250, 83, 76, 0.7);
 */
